// 验证规则
$('#request_tx').validate({
    rules: {
        khr_name: {
            required: true,
            maxlength: 5
        },
        khh: {
            required: true
        },
        bankCard: {
            required: true,
            banknum:true
        },
        bzlx: {
            required: true
        },
        tx_money: {
            required: true,
            digits:true,
            min:100
        },
        tel: {
            required: true,
            telNum:true
        },
        jyPW: {
            required: true,
            password: true
        },
        zfb_zh: {
            required: true
        },
        txr_name:{
            required: true,
            maxlength: 5
        },
        wx_zh:{
            required: true
        }
    },
    messages: {

    },
    errorPlacement: function (error, element) {
        $(element).siblings('.u-ts').html(error)
    },
    errorElement: 'span',
    submitHandler: function (form) {
        form.submit();
    }
});

jQuery.validator.addMethod('password', function (value, element) {
    var password = /^[a-z0-9_-]{6,18}$/.test(value);
    return this.optional(element) || password
}, '请输入6-18位字母，数字_-');

jQuery.validator.addMethod('select', function (value, element) {
    return this.optional(element) || (value !== '0')
}, '请选择提现币种类型');

jQuery.validator.addMethod('banknum', function (value, element) {
    var num = /\d{15}|\d{19}/.test(value);
    return this.optional(element) || num
}, '请输入正确银行卡号');

jQuery.validator.addMethod('telNum', function (value, element) {
    var phoneNum = /^[1][34578][\d]{9}$/.test(value);
    return this.optional(element) || phoneNum
}, '请输入正确手机号');